package zhongbo.java.air.monitor.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.Topic;
import zhongbo.java.air.monitor.listener.RedisSubscribeLogChanelListener;

@Configuration
@Slf4j
public class RedisListenerConfig{
    /**
     * 公共静态常量 定义频道名称
     */
    public static String LIVE_FLIGHT="live_flight_path_ltx";


    @Autowired
    public void configlistener(RedisMessageListenerContainer listenerContainer,
                               RedisSubscribeLogChanelListener logChanelListener) {
        log.info("配置redis监听器");
        Topic logTopic = new PatternTopic(LIVE_FLIGHT);
        listenerContainer.addMessageListener(logChanelListener, logTopic);
    }
}